#include "Customer.hh"
#include "AccountUtils.hh"
#include <iostream>

namespace Bank {
    //Constructor: Automatically generate savings and checking accounts based on name.
    Customer::Customer(const std::string& name)
        : name(name)
    {
        // Automatically generate unique savings account and checking account IDs.
        std::string savingsId = generateUniqueAccountId(21);  // 62XX
        std::string checkingId = generateUniqueAccountId(22); // 63XX

        // Create a savings account and a checking account
        savingsAccount = std::make_shared<SavingsAccount>(savingsId, name);
        checkingAccount = std::make_shared<CheckingAccount>(checkingId, name);
    }

    std::string Customer::getName() const {
        return name;
    }

    std::shared_ptr<SavingsAccount> Customer::getSavingsAccount() const {
        return savingsAccount;
    }

    std::shared_ptr<CheckingAccount> Customer::getCheckingAccount() const {
        return checkingAccount;
    }

    void Customer::displayCustomerAccounts() const {
        std::cout << "===== Customer: " << name << " =====\n";
        std::cout << "1. Savings Account: ";
        savingsAccount->displayInfo();
        std::cout << "\n2. Checking Account: ";
        checkingAccount->displayInfo();
        std::cout << std::endl;
    }
}


